package com.lwt.codetop.binaryTree;

import java.util.ArrayList;
import java.util.List;

// 94. 二叉树的中序遍历
public class BinaryTreeInorderTraversal {
    public static void main(String[] args) {
        TreeNode root = new TreeNode(1);
        root.right = new TreeNode(2);
        root.right.left = new TreeNode(3);
        List<Integer> res = new ArrayList<>();
        dfs(root, res);
        System.out.println(res);
    }
    private static void dfs(TreeNode root, List<Integer> res){
        if(root == null) return;
        dfs(root.left, res);
        res.add(root.val);
        dfs(root.right, res);
    }
}
